package com.ctlele.team.space.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLiteHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "we_space";

    private final String createSQL;

    private static final int DATABASE_VERSION = 1;

    public SQLiteHelper(Context context, String createSQL) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        this.createSQL = createSQL;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(createSQL);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//        String dropTableQuery = "DROP TABLE IF EXISTS " + tableName;
//        db.execSQL(dropTableQuery);
//        onCreate(db);
    }

    public SQLiteDatabase read() {
        return getReadableDatabase();
    }

    public SQLiteDatabase write() {
        return getWritableDatabase();
    }
}
